﻿using System;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	// Token: 0x02000C4B RID: 3147
	internal class XMentorshipPupilsHandler : DlgHandlerBase
	{
		// Token: 0x1700318E RID: 12686
		// (get) Token: 0x0600B279 RID: 45689 RVA: 0x00226F7C File Offset: 0x0022517C
		protected override string FileName
		{
			get
			{
				return "GameSystem/TeacherPupil";
			}
		}

		// Token: 0x0600B27A RID: 45690 RVA: 0x00226F93 File Offset: 0x00225193
		protected override void Init()
		{
			base.Init();
			this.InitProperties();
		}

		// Token: 0x0600B27B RID: 45691 RVA: 0x0019EEB0 File Offset: 0x0019D0B0
		public override void RegisterEvent()
		{
			base.RegisterEvent();
		}

		// Token: 0x0600B27C RID: 45692 RVA: 0x00226FA4 File Offset: 0x002251A4
		protected override void OnShow()
		{
			base.OnShow();
			this._currentRoleID = 0UL;
			XMentorshipDocument.Doc.SendMentorshipInfoReq();
		}

		// Token: 0x0600B27D RID: 45693 RVA: 0x0019EEFD File Offset: 0x0019D0FD
		protected override void OnHide()
		{
			base.OnHide();
		}

		// Token: 0x0600B27E RID: 45694 RVA: 0x00226FC1 File Offset: 0x002251C1
		public override void OnUnload()
		{
			this._currentRoleID = 0UL;
			base.OnUnload();
		}

		// Token: 0x0600B27F RID: 45695 RVA: 0x00226FD4 File Offset: 0x002251D4
		public void RefreshUI()
		{
			MyMentorship myMentorShip = XMentorshipDocument.Doc.GetMyMentorShip();
			this.InitItemsShowOrNot(myMentorShip);
			switch (myMentorShip)
			{
			case MyMentorship.None:
				this.UpdateNoneRelationUI();
				break;
			case MyMentorship.Mentorship_Pupil:
				this.UpdatePupilUI();
				break;
			case MyMentorship.Mentorship_Master:
				this.UpdateMasterUI();
				break;
			}
		}

		// Token: 0x0600B280 RID: 45696 RVA: 0x00227028 File Offset: 0x00225228
		public void OnSettingOk()
		{
			this._setting.gameObject.SetActive(false);
			this.UpdateMentorshipPromise();
		}

		// Token: 0x0600B281 RID: 45697 RVA: 0x00227044 File Offset: 0x00225244
		public void RefreshTaskItems()
		{
			this._reportWrapContent.RefreshAllVisibleContents();
			this.RefreshRelationRightViewByRoleID();
			this.RefreshRedPoint();
		}

		// Token: 0x0600B282 RID: 45698 RVA: 0x00227064 File Offset: 0x00225264
		public void UpdateInheritTaskItem()
		{
			MentorRelationInfo relationTargetInfoByRoleID = XMentorshipDocument.Doc.GetRelationTargetInfoByRoleID(this._currentRoleID);
			bool flag = relationTargetInfoByRoleID != null;
			if (flag)
			{
				this.RefreshRedPoint();
				IXUIButton ixuibutton = this._gongKuTaskItemTrans.Find("Operation").GetComponent("XUIButton") as IXUIButton;
				ixuibutton.ID = this._currentRoleID;
				IXUILabel ixuilabel = this._gongKuTaskItemTrans.Find("Operation/GetLabel").GetComponent("XUILabel") as IXUILabel;
				IXUILabel ixuilabel2 = this._gongKuTaskItemTrans.Find("Rewards").GetComponent("XUILabel") as IXUILabel;
				IXUISprite ixuisprite = this._gongKuTaskItemTrans.Find("Rewards/Icon").GetComponent("XUISprite") as IXUISprite;
				SeqList<int> sequenceList = XSingleton<XGlobalConfig>.singleton.GetSequenceList("TeacherInheritRewards", true);
				ixuilabel2.SetText((sequenceList[0, 1] == 0) ? "" : sequenceList[0, 1].ToString());
				ItemList.RowData itemConf = XBagDocument.GetItemConf(sequenceList[0, 0]);
				ixuisprite.SetSprite(itemConf.ItemIcon1[0]);
				Transform transform = this._gongKuTaskItemTrans.Find("Operation/RedPoint");
				transform.gameObject.SetActive(false);
				ixuibutton.SetEnable(true, false);
				EMentorTaskStatus inheritStatus = relationTargetInfoByRoleID.inheritStatus;
				if (inheritStatus != EMentorTaskStatus.EMentorTask_CanReport)
				{
					if (inheritStatus != EMentorTaskStatus.EMentorTask_AlreadyReport)
					{
						ixuilabel.SetText(XSingleton<XStringTable>.singleton.GetString("InheritFinishMentor"));
						ixuibutton.SetEnable(false, false);
					}
					else
					{
						bool flag2 = relationTargetInfoByRoleID.inheritApplyRoleID != XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
						if (flag2)
						{
							ixuilabel.SetText(XSingleton<XStringTable>.singleton.GetString("ToAccept"));
							transform.gameObject.SetActive(true);
						}
						else
						{
							ixuibutton.SetEnable(false, false);
							ixuilabel.SetText(XSingleton<XStringTable>.singleton.GetString("CHAT_SENT"));
						}
					}
				}
				else
				{
					ixuilabel.SetText(XSingleton<XStringTable>.singleton.GetString("InheritMentor"));
				}
			}
		}

		// Token: 0x0600B283 RID: 45699 RVA: 0x00227274 File Offset: 0x00225474
		public void RefreshRedPoint()
		{
			int relationIndexByRoleID = XMentorshipDocument.Doc.GetRelationIndexByRoleID(this._currentRoleID);
			bool flag = relationIndexByRoleID >= 0;
			if (flag)
			{
				Transform transform = this._hasMentorship.Find("Pupil" + (relationIndexByRoleID + 1) + "/RedPoint");
				transform.gameObject.SetActive(XMentorshipDocument.Doc.GetOneRedStausByIndex(relationIndexByRoleID));
				bool flag2 = XMentorshipDocument.Doc.GetMyMentorShip() == MyMentorship.Mentorship_Pupil;
				if (flag2)
				{
					bool active = !XMentorshipDocument.Doc.IsAllReported(this._currentRoleID);
					this._reportBtn.gameObject.transform.Find("RedPoint").gameObject.SetActive(active);
				}
			}
		}

		// Token: 0x0600B284 RID: 45700 RVA: 0x0022732C File Offset: 0x0022552C
		private void InitProperties()
		{
			this.InitStateTransProperties();
			this.InitNoMentorshipProperties();
			this.InitHasMentorShipProperties();
			this.InitSettingProperties();
			this.InitPupilRewardsProperties();
		}

		// Token: 0x0600B285 RID: 45701 RVA: 0x00227354 File Offset: 0x00225554
		private void InitPupilRewardsProperties()
		{
			IXUIButton ixuibutton = this._pupilRewards.Find("Close").GetComponent("XUIButton") as IXUIButton;
			ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClosePupilRewards));
		}

		// Token: 0x0600B286 RID: 45702 RVA: 0x00227398 File Offset: 0x00225598
		private bool OnClosePupilRewards(IXUIButton button)
		{
			this._pupilRewards.gameObject.SetActive(false);
			return true;
		}

		// Token: 0x0600B287 RID: 45703 RVA: 0x002273C0 File Offset: 0x002255C0
		private void InitSettingProperties()
		{
			this._footPrintCheck = (this._setting.Find("CheckMentorship").GetComponent("XUICheckBox") as IXUICheckBox);
			this._footPrintCheck.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this.OnLeaveFootPrintToggle));
			IXUIButton ixuibutton = this._setting.Find("ok").GetComponent("XUIButton") as IXUIButton;
			ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnConfirmSetting));
			IXUIButton ixuibutton2 = this._setting.Find("Close").GetComponent("XUIButton") as IXUIButton;
			ixuibutton2.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseSettingDialog));
			this._footPrintLabel = (this._footPrintCheck.gameObject.transform.Find("Mentorship").GetComponent("XUILabel") as IXUILabel);
			this._PromiseContentInput = (this._setting.Find("PromiseContentBg").GetComponent("XUIInput") as IXUIInput);
		}

		// Token: 0x0600B288 RID: 45704 RVA: 0x002274C8 File Offset: 0x002256C8
		private bool OnConfirmSetting(IXUIButton button)
		{
			bool flag = (this._footPrintCheck.bChecked ^ !XMentorshipDocument.Doc.LeaveFootprint) || !this._PromiseContentInput.GetText().Equals(XMentorshipDocument.Doc.MentorshipApplyWords);
			if (flag)
			{
				XMentorshipDocument.Doc.SendUpdateMentorshopSetting(this._PromiseContentInput.GetText(), this._footPrintCheck.bChecked);
			}
			else
			{
				this._setting.gameObject.SetActive(false);
			}
			return true;
		}

		// Token: 0x0600B289 RID: 45705 RVA: 0x00227553 File Offset: 0x00225753
		private void OnDragPressBtn(IXUIButton button, Vector2 delta)
		{
			this._dragDistance += delta;
			this._isCancelRecord = (this._dragDistance.magnitude >= 100f);
		}

		// Token: 0x0600B28A RID: 45706 RVA: 0x00227584 File Offset: 0x00225784
		private bool OnCloseSettingDialog(IXUIButton button)
		{
			this._setting.gameObject.SetActive(false);
			return true;
		}

		// Token: 0x0600B28B RID: 45707 RVA: 0x002275AC File Offset: 0x002257AC
		private bool OnLeaveFootPrintToggle(IXUICheckBox iXUICheckBox)
		{
			XMentorshipDocument.Doc.LeaveFootprint = iXUICheckBox.bChecked;
			return true;
		}

		// Token: 0x0600B28C RID: 45708 RVA: 0x002275D0 File Offset: 0x002257D0
		private void InitHasMentorShipProperties()
		{
			IXUIButton ixuibutton = this._hasMentorship.Find("MentorshipMall").GetComponent("XUIButton") as IXUIButton;
			ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickMallBtn));
			IXUIButton ixuibutton2 = this._hasMentorship.Find("RewardsRules").GetComponent("XUIButton") as IXUIButton;
			ixuibutton2.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickRewardsBtn));
			IXUIButton ixuibutton3 = this._hasMentorship.Find("PrivateChat").GetComponent("XUIButton") as IXUIButton;
			ixuibutton3.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickPrivateChatBtn));
			this._reportBtn = (this._hasMentorship.Find("AllReport").GetComponent("XUIButton") as IXUIButton);
			this._reportBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickAllReportBtn));
			IXUIButton ixuibutton4 = this._hasMentorship.Find("AddMentorship/Add").GetComponent("XUIButton") as IXUIButton;
			ixuibutton4.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickAddMentorShipBtn));
			IXUISprite ixuisprite = this._hasMentorship.Find("CurrentMentorInstruction/NextStep").GetComponent("XUISprite") as IXUISprite;
			ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnClickNextStep));
			IXUISprite ixuisprite2 = this._noMentorship.Find("NextStep").GetComponent("XUISprite") as IXUISprite;
			ixuisprite2.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnClickNextStep));
			this._reportWrapContent = (this._hasMentorship.Find("MentorshipTask/ScrollPanel/WrapContent").GetComponent("XUIWrapContent") as IXUIWrapContent);
			this._scrollView = (this._hasMentorship.Find("MentorshipTask/ScrollPanel").GetComponent("XUIScrollView") as IXUIScrollView);
			this._reportWrapContent.RegisterItemInitEventHandler(new WrapItemInitEventHandler(this.ReportWrapContentInit));
			this._reportWrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.ReportWrapContentUpdate));
		}

		// Token: 0x0600B28D RID: 45709 RVA: 0x002277CC File Offset: 0x002259CC
		private void ReportWrapContentUpdate(Transform itemTransform, int index)
		{
			MyMentorship myMentorShip = XMentorshipDocument.Doc.GetMyMentorShip();
			bool flag = myMentorShip == MyMentorship.Mentorship_Pupil;
			MentorshipTaskInfo mentorshipTaskInfo;
			if (flag)
			{
				mentorshipTaskInfo = XMentorshipDocument.Doc.GetMyMentorshipTaskInfoByIndex(index);
			}
			else
			{
				mentorshipTaskInfo = XMentorshipDocument.Doc.GetTaskInfoWithIndexAndRoleID(index, this._currentRoleID);
			}
			bool flag2 = mentorshipTaskInfo != null;
			if (flag2)
			{
				MentorTaskTable.RowData tableTaskInfoByTaskID = XMentorshipDocument.Doc.GetTableTaskInfoByTaskID((uint)mentorshipTaskInfo.taskID);
				bool flag3 = tableTaskInfoByTaskID != null;
				if (flag3)
				{
					IXUILabel ixuilabel = itemTransform.Find("taskDes").GetComponent("XUILabel") as IXUILabel;
					ixuilabel.SetText(tableTaskInfoByTaskID.TaskName);
					IXUILabel ixuilabel2 = itemTransform.Find("Rewards").GetComponent("XUILabel") as IXUILabel;
					IXUISprite ixuisprite = itemTransform.Find("Rewards/Icon").GetComponent("XUISprite") as IXUISprite;
					bool flag4 = myMentorShip == MyMentorship.Mentorship_Master;
					if (flag4)
					{
						bool flag5 = tableTaskInfoByTaskID.MasterReward.count > 0;
						if (flag5)
						{
							ixuilabel2.SetText(tableTaskInfoByTaskID.MasterReward[0, 1].ToString());
							ItemList.RowData itemConf = XBagDocument.GetItemConf(tableTaskInfoByTaskID.MasterReward[0, 0]);
							ixuisprite.SetSprite(itemConf.ItemIcon1[0]);
						}
					}
					else
					{
						bool flag6 = tableTaskInfoByTaskID.StudentReward.count > 0;
						if (flag6)
						{
							ixuilabel2.SetText(tableTaskInfoByTaskID.StudentReward[0, 1].ToString());
							ItemList.RowData itemConf2 = XBagDocument.GetItemConf(tableTaskInfoByTaskID.StudentReward[0, 0]);
							ixuisprite.SetSprite(itemConf2.ItemIcon1[0]);
						}
					}
					IXUILabel ixuilabel3 = itemTransform.Find("Progress").GetComponent("XUILabel") as IXUILabel;
					ixuilabel3.gameObject.SetActive(false);
					bool flag7 = tableTaskInfoByTaskID.TaskType == 3U || tableTaskInfoByTaskID.TaskType == 29U;
					int num = flag7 ? 1 : tableTaskInfoByTaskID.TaskVar[1];
					int num2 = mentorshipTaskInfo.completeProgress;
					bool flag8 = flag7;
					if (flag8)
					{
						num2 = ((mentorshipTaskInfo.completeTime == 0) ? 0 : 1);
					}
					ixuilabel3.SetText(num2 + "/" + num);
					IXUIButton ixuibutton = itemTransform.Find("Operation").GetComponent("XUIButton") as IXUIButton;
					ixuibutton.ID = (ulong)((long)mentorshipTaskInfo.taskID);
					Transform transform = ixuibutton.gameObject.transform.Find("RedPoint");
					transform.gameObject.SetActive(false);
					IXUILabel ixuilabel4 = ixuibutton.gameObject.transform.Find("GetLabel").GetComponent("XUILabel") as IXUILabel;
					ixuibutton.gameObject.SetActive(true);
					ixuibutton.SetEnable(true, false);
					EMentorTaskStatus ementorTaskStatus = EMentorTaskStatus.EMentorTask_UnComplete;
					for (int i = 0; i < mentorshipTaskInfo.taskStatusList.Count; i++)
					{
						MentorshipTaskStatus mentorshipTaskStatus = mentorshipTaskInfo.taskStatusList[i];
						bool flag9 = mentorshipTaskStatus.roleID == this._currentRoleID;
						if (flag9)
						{
							ementorTaskStatus = (EMentorTaskStatus)mentorshipTaskStatus.status;
							break;
						}
					}
					bool flag10 = ementorTaskStatus == EMentorTaskStatus.EMentorTask_UnComplete;
					if (flag10)
					{
						ixuibutton.gameObject.SetActive(false);
						ixuilabel3.gameObject.SetActive(true);
					}
					else
					{
						bool flag11 = ementorTaskStatus == EMentorTaskStatus.EMentorTask_CanReport;
						if (flag11)
						{
							bool flag12 = myMentorShip == MyMentorship.Mentorship_Pupil;
							if (flag12)
							{
								transform.gameObject.SetActive(true);
								ixuilabel4.SetText(XSingleton<XStringTable>.singleton.GetString("Report"));
							}
							else
							{
								ixuibutton.gameObject.SetActive(false);
								ixuilabel3.gameObject.SetActive(true);
							}
						}
						else
						{
							bool flag13 = ementorTaskStatus == EMentorTaskStatus.EMentorTask_AlreadyReport;
							if (flag13)
							{
								bool flag14 = myMentorShip == MyMentorship.Mentorship_Pupil;
								if (flag14)
								{
									ixuilabel4.SetText(XSingleton<XStringTable>.singleton.GetString("Reported"));
									ixuibutton.SetEnable(false, false);
								}
								else
								{
									transform.gameObject.SetActive(true);
									ixuilabel4.SetText(XSingleton<XStringTable>.singleton.GetString("ToConfirm"));
								}
							}
							else
							{
								ixuilabel4.SetText(XSingleton<XStringTable>.singleton.GetString("Completed"));
								ixuibutton.SetEnable(false, false);
							}
						}
					}
				}
			}
		}

		// Token: 0x0600B28E RID: 45710 RVA: 0x00227C04 File Offset: 0x00225E04
		private void ReportWrapContentInit(Transform itemTransform, int index)
		{
			IXUIButton ixuibutton = itemTransform.Find("Operation").GetComponent("XUIButton") as IXUIButton;
			ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickOperation));
		}

		// Token: 0x0600B28F RID: 45711 RVA: 0x00227C40 File Offset: 0x00225E40
		private bool OnClickOperation(IXUIButton button)
		{
			MyMentorship myMentorShip = XMentorshipDocument.Doc.GetMyMentorShip();
			bool flag = myMentorShip == MyMentorship.Mentorship_Master;
			if (flag)
			{
				XMentorshipDocument.Doc.SendCandidatesOpReq(EMentorMsgOpType.EMentorMsgOpType_Agree, this._currentRoleID, MentorMsgApplyType.MentorMsgApplyReportTask, (int)button.ID, false);
			}
			else
			{
				XMentorshipDocument.Doc.SendMentorRelationOp(MentorRelationOpType.MentorRelationOp_ReportTask, this._currentRoleID, (int)button.ID);
			}
			return true;
		}

		// Token: 0x0600B290 RID: 45712 RVA: 0x00227C9C File Offset: 0x00225E9C
		private bool OnClickAllReportBtn(IXUIButton button)
		{
			bool flag = !XMentorshipDocument.Doc.IsAllReported(this._currentRoleID);
			if (flag)
			{
				XMentorshipDocument.Doc.SendMentorRelationOp(MentorRelationOpType.MentorRelationOp_ReportAllTask, this._currentRoleID, 0);
			}
			else
			{
				XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("CompleteTaskToReport"), "fece00");
			}
			return true;
		}

		// Token: 0x0600B291 RID: 45713 RVA: 0x00227D00 File Offset: 0x00225F00
		private bool OnClickPrivateChatBtn(IXUIButton button)
		{
			XFriendData friendDataById = DlgBase<XFriendsView, XFriendsBehaviour>.singleton.GetFriendDataById(this._currentRoleID);
			bool flag = friendDataById != null;
			if (flag)
			{
				ChatFriendData chatFriendData = new ChatFriendData();
				chatFriendData.name = friendDataById.name;
				chatFriendData.roleid = friendDataById.roleid;
				chatFriendData.powerpoint = friendDataById.powerpoint;
				chatFriendData.profession = friendDataById.profession;
				chatFriendData.viplevel = friendDataById.viplevel;
				chatFriendData.isfriend = true;
				chatFriendData.msgtime = DateTime.Now;
				chatFriendData.setid = friendDataById.setid;
				DlgBase<XChatView, XChatBehaviour>.singleton.PrivateChatTo(chatFriendData);
			}
			return true;
		}

		// Token: 0x0600B292 RID: 45714 RVA: 0x00227D9C File Offset: 0x00225F9C
		private void InitNoMentorshipProperties()
		{
			IXUIButton ixuibutton = this._noMentorship.Find("MentorshipMall").GetComponent("XUIButton") as IXUIButton;
			ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickMallBtn));
			IXUIButton ixuibutton2 = this._noMentorship.Find("RewarsRules").GetComponent("XUIButton") as IXUIButton;
			ixuibutton2.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickRewardsBtn));
			IXUIButton ixuibutton3 = this._noMentorship.Find("Setting").GetComponent("XUIButton") as IXUIButton;
			ixuibutton3.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickSettingBtn));
			IXUIButton ixuibutton4 = this._noMentorship.Find("Bg/Pupil/PupilBg").GetComponent("XUIButton") as IXUIButton;
			ixuibutton4.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnToGetPupils));
			IXUIButton ixuibutton5 = this._noMentorship.Find("Bg/Master/MasterBg").GetComponent("XUIButton") as IXUIButton;
			ixuibutton5.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnToGetMaster));
			this._pupilCondition = (this._noMentorship.Find("Bg/Pupil/PupilCondition").GetComponent("XUILabel") as IXUILabel);
			this._masterCondition = (this._noMentorship.Find("Bg/Master/MasterCondition").GetComponent("XUILabel") as IXUILabel);
		}

		// Token: 0x0600B293 RID: 45715 RVA: 0x00227EF8 File Offset: 0x002260F8
		private bool OnToGetMaster(IXUIButton button)
		{
			bool flag = XMentorshipDocument.Doc.GetMyPossibleMentorship() == MyMentorship.Mentorship_Pupil;
			if (flag)
			{
				XMentorshipDocument.Doc.SetCandidatesViewVisible(CandidatesViewType.Recommend, CandidatesViewRecommendType.Master);
				XMentorshipDocument.Doc.SendToGetMyApplyMasterInfo(false);
			}
			else
			{
				XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("CantApplyMaster"), "fece00");
			}
			return true;
		}

		// Token: 0x0600B294 RID: 45716 RVA: 0x00227F5C File Offset: 0x0022615C
		private bool OnToGetPupils(IXUIButton button)
		{
			bool flag = XMentorshipDocument.Doc.GetMyPossibleMentorship() == MyMentorship.Mentorship_Master;
			if (flag)
			{
				XMentorshipDocument.Doc.SetCandidatesViewVisible(CandidatesViewType.Recommend, CandidatesViewRecommendType.Pupil);
				XMentorshipDocument.Doc.SendToGetMyApplyPupilsInfo(false);
			}
			else
			{
				XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("CantApplyPupil"), "fece00");
			}
			return true;
		}

		// Token: 0x0600B295 RID: 45717 RVA: 0x00227FC0 File Offset: 0x002261C0
		private bool OnClickSettingBtn(IXUIButton button)
		{
			this._setting.gameObject.SetActive(true);
			return true;
		}

		// Token: 0x0600B296 RID: 45718 RVA: 0x00227FE8 File Offset: 0x002261E8
		private bool OnClickRewardsBtn(IXUIButton button)
		{
			this._pupilRewards.gameObject.SetActive(true);
			this.UpdatePupilRewardsDialog();
			return true;
		}

		// Token: 0x0600B297 RID: 45719 RVA: 0x00228014 File Offset: 0x00226214
		private void UpdatePupilRewardsDialog()
		{
			IXUILabel ixuilabel = this._pupilRewards.Find("Normal/Base").GetComponent("XUILabel") as IXUILabel;
			ixuilabel.SetText(string.Format(XSingleton<XStringTable>.singleton.GetString("CompletMentorTask"), XSingleton<XGlobalConfig>.singleton.GetInt("Mentor_NormalComplete"), "<" + XSingleton<XGlobalConfig>.singleton.GetInt("Mentor_PerfectComplete")));
			IXUILabel ixuilabel2 = this._pupilRewards.Find("Perfect/More").GetComponent("XUILabel") as IXUILabel;
			ixuilabel2.SetText(string.Format(XSingleton<XStringTable>.singleton.GetString("CompletMentorTask"), XSingleton<XGlobalConfig>.singleton.GetInt("Mentor_PerfectComplete"), ""));
			MentorCompleteRewardTable mentorCompleteReward = XMentorshipDocument.MentorCompleteReward;
			MentorCompleteRewardTable.RowData byType = mentorCompleteReward.GetByType(1);
			SeqListRef<int> seqListRef = (XMentorshipDocument.Doc.GetMyMentorShip() == MyMentorship.Mentorship_Master) ? byType.MasterReward : byType.StudentReward;
			Transform transform = this._pupilRewards.Find("Normal/PupilRewards");
			Transform transform2 = this._pupilRewards.Find("Normal/MasterRewards");
			XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(transform.gameObject, seqListRef[0, 0], seqListRef[0, 1], false);
			IXUISprite ixuisprite = transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
			ixuisprite.ID = (ulong)((long)seqListRef[0, 0]);
			ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(XSingleton<UiUtility>.singleton.OnItemClick));
			XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(transform2.gameObject, seqListRef[1, 0], seqListRef[1, 1], false);
			IXUISprite ixuisprite2 = transform2.Find("Icon").GetComponent("XUISprite") as IXUISprite;
			ixuisprite2.ID = (ulong)((long)seqListRef[1, 0]);
			ixuisprite2.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(XSingleton<UiUtility>.singleton.OnItemClick));
			MentorCompleteRewardTable.RowData byType2 = mentorCompleteReward.GetByType(2);
			seqListRef = ((XMentorshipDocument.Doc.GetMyMentorShip() == MyMentorship.Mentorship_Master) ? byType2.MasterReward : byType2.StudentReward);
			Transform transform3 = this._pupilRewards.Find("Perfect/PupilRewards");
			Transform transform4 = this._pupilRewards.Find("Perfect/MasterRewards");
			XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(transform3.gameObject, seqListRef[0, 0], seqListRef[0, 1], false);
			ixuisprite = (transform3.Find("Icon").GetComponent("XUISprite") as IXUISprite);
			ixuisprite.ID = (ulong)((long)seqListRef[0, 0]);
			ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(XSingleton<UiUtility>.singleton.OnItemClick));
			XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(transform4.gameObject, seqListRef[1, 0], seqListRef[1, 1], false);
			ixuisprite2 = (transform4.Find("Icon").GetComponent("XUISprite") as IXUISprite);
			ixuisprite2.ID = (ulong)((long)seqListRef[1, 0]);
			ixuisprite2.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(XSingleton<UiUtility>.singleton.OnItemClick));
		}

		// Token: 0x0600B298 RID: 45720 RVA: 0x00228344 File Offset: 0x00226544
		private bool OnClickMallBtn(IXUIButton button)
		{
			DlgBase<MallSystemDlg, MallSystemBehaviour>.singleton.ShowShopSystem(XSysDefine.XSys_Mall_Mentorship, 0UL);
			return true;
		}

		// Token: 0x0600B299 RID: 45721 RVA: 0x0022836C File Offset: 0x0022656C
		private bool OnClickApplyNewsBtn(IXUIButton button)
		{
			XMentorshipDocument.Doc.SetCandidatesViewVisible(CandidatesViewType.Application, CandidatesViewRecommendType.None);
			return true;
		}

		// Token: 0x0600B29A RID: 45722 RVA: 0x0022838C File Offset: 0x0022658C
		private void InitStateTransProperties()
		{
			this._noMentorship = base.transform.Find("NoMentorship");
			this._hasMentorship = base.transform.Find("HasMentorship");
			this._setting = base.transform.Find("ReName");
			this._pupilRewards = base.transform.Find("Pupilreward");
			this._gongKuTaskItemTrans = this._hasMentorship.Find("MentorshipTask/Gongku");
			this._noMentorship.gameObject.SetActive(true);
			this._hasMentorship.gameObject.SetActive(true);
			this._setting.gameObject.SetActive(true);
			this._pupilRewards.gameObject.SetActive(true);
			IXUIButton ixuibutton = this._gongKuTaskItemTrans.Find("Operation").GetComponent("XUIButton") as IXUIButton;
			ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickToInherit));
		}

		// Token: 0x0600B29B RID: 45723 RVA: 0x00228484 File Offset: 0x00226684
		private bool OnClickToInherit(IXUIButton button)
		{
			MentorRelationInfo relationTargetInfoByRoleID = XMentorshipDocument.Doc.GetRelationTargetInfoByRoleID(this._currentRoleID);
			bool flag = relationTargetInfoByRoleID == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				bool flag2 = relationTargetInfoByRoleID.inheritApplyRoleID == this._currentRoleID;
				if (flag2)
				{
					XMentorshipDocument.Doc.SendCandidatesOpReq(EMentorMsgOpType.EMentorMsgOpType_Agree, this._currentRoleID, MentorMsgApplyType.MentorMsgApplyInherit, 0, false);
				}
				else
				{
					XMentorshipDocument.Doc.SendMentorRelationOp(MentorRelationOpType.MentorRelationOp_Inherit, this._currentRoleID, 0);
				}
				result = true;
			}
			return result;
		}

		// Token: 0x0600B29C RID: 45724 RVA: 0x002284F4 File Offset: 0x002266F4
		private void InitItemsShowOrNot(MyMentorship relation)
		{
			this._pupilRewards.gameObject.SetActive(false);
			this._setting.gameObject.SetActive(false);
			this._noMentorship.gameObject.SetActive(relation == MyMentorship.None);
			this._hasMentorship.gameObject.SetActive(relation == MyMentorship.Mentorship_Pupil || relation == MyMentorship.Mentorship_Master);
			this._PromiseContentInput.SetText(XMentorshipDocument.Doc.MentorshipApplyWords);
			this._footPrintCheck.bChecked = !XMentorshipDocument.Doc.LeaveFootprint;
		}

		// Token: 0x0600B29D RID: 45725 RVA: 0x00228586 File Offset: 0x00226786
		private void UpdateMasterUI()
		{
			this.UpdateTargetsLeftUI();
			this.UpdateDefaultSelectRole();
		}

		// Token: 0x0600B29E RID: 45726 RVA: 0x00228598 File Offset: 0x00226798
		private void UpdateMasterRightUI()
		{
			this._reportBtn.gameObject.SetActive(false);
			int myPupilTaskTotalNumber = XMentorshipDocument.Doc.GetMyPupilTaskTotalNumber(this._currentRoleID);
			this._reportWrapContent.SetContentCount(myPupilTaskTotalNumber, false);
			this._scrollView.ResetPosition();
			this.UpdateInheritTaskItem();
		}

		// Token: 0x0600B29F RID: 45727 RVA: 0x002285EA File Offset: 0x002267EA
		private void UpdatePupilUI()
		{
			this.UpdateTargetsLeftUI();
			this.UpdateDefaultSelectRole();
			this.UpdatePupilRightUI();
		}

		// Token: 0x0600B2A0 RID: 45728 RVA: 0x00228604 File Offset: 0x00226804
		private void UpdateDefaultSelectRole()
		{
			bool flag = this._currentRoleID == 0UL;
			if (flag)
			{
				this.RefreshDefaultOneRelation();
			}
			else
			{
				int relationIndexByRoleID = XMentorshipDocument.Doc.GetRelationIndexByRoleID(this._currentRoleID);
				bool flag2 = relationIndexByRoleID >= 0;
				if (flag2)
				{
					Transform transform = this._hasMentorship.Find("Pupil" + (relationIndexByRoleID + 1));
					IXUICheckBox ixuicheckBox = transform.GetComponent("XUICheckBox") as IXUICheckBox;
					bool bChecked = ixuicheckBox.bChecked;
					if (bChecked)
					{
						this.OnToggleRelationTarget(ixuicheckBox);
					}
					else
					{
						ixuicheckBox.ForceSetFlag(true);
					}
				}
				else
				{
					this.RefreshDefaultOneRelation();
				}
			}
		}

		// Token: 0x0600B2A1 RID: 45729 RVA: 0x002286A8 File Offset: 0x002268A8
		private void RefreshDefaultOneRelation()
		{
			int relationTargetsCount = XMentorshipDocument.Doc.GetRelationTargetsCount();
			bool flag = relationTargetsCount <= 0;
			if (!flag)
			{
				this._currentRoleID = XMentorshipDocument.Doc.GetRelationTargetInfo(0).roleInfo.roleID;
				Transform transform = this._hasMentorship.Find("Pupil1");
				IXUICheckBox ixuicheckBox = transform.GetComponent("XUICheckBox") as IXUICheckBox;
				bool bChecked = ixuicheckBox.bChecked;
				if (bChecked)
				{
					this.OnToggleRelationTarget(ixuicheckBox);
				}
				else
				{
					ixuicheckBox.ForceSetFlag(true);
				}
			}
		}

		// Token: 0x0600B2A2 RID: 45730 RVA: 0x0022872C File Offset: 0x0022692C
		private void UpdatePupilRightUI()
		{
			this._reportBtn.gameObject.SetActive(true);
			int myMentorshipTaskCount = XMentorshipDocument.Doc.GetMyMentorshipTaskCount();
			this._reportWrapContent.SetContentCount(myMentorshipTaskCount, false);
			this._scrollView.ResetPosition();
			this.UpdateInheritTaskItem();
		}

		// Token: 0x0600B2A3 RID: 45731 RVA: 0x00228778 File Offset: 0x00226978
		private void UpdateTargetsLeftUI()
		{
			this.UpdateMentorshipPromise();
			int relationTargetsCount = XMentorshipDocument.Doc.GetRelationTargetsCount();
			bool flag = relationTargetsCount <= 0;
			if (!flag)
			{
				Transform item = this._hasMentorship.Find("Pupil1");
				this.UpdatePupilsItem(item, XMentorshipDocument.Doc.GetRelationTargetInfo(0).roleInfo);
				Transform transform = this._hasMentorship.Find("Pupil2");
				Transform transform2 = this._hasMentorship.Find("AddMentorship");
				bool flag2 = relationTargetsCount > 1;
				if (flag2)
				{
					transform.gameObject.SetActive(true);
					transform2.gameObject.SetActive(false);
					this.UpdatePupilsItem(transform, XMentorshipDocument.Doc.GetRelationTargetInfo(1).roleInfo);
				}
				else
				{
					transform2.gameObject.SetActive(true);
					transform.gameObject.SetActive(false);
				}
			}
		}

		// Token: 0x0600B2A4 RID: 45732 RVA: 0x00228854 File Offset: 0x00226A54
		private void UpdateMentorshipPromise()
		{
			Transform transform = this._hasMentorship.Find("MentorshipPromise");
			IXUILabel ixuilabel = transform.Find("title").GetComponent("XUILabel") as IXUILabel;
			IXUILabel ixuilabel2 = transform.Find("Promise").GetComponent("XUILabel") as IXUILabel;
			MyMentorship myMentorShip = XMentorshipDocument.Doc.GetMyMentorShip();
			bool flag = myMentorShip == MyMentorship.Mentorship_Pupil;
			if (flag)
			{
				ixuilabel.SetText(XSingleton<XStringTable>.singleton.GetString("MaterPromiseTitle"));
			}
			else
			{
				ixuilabel.SetText(XSingleton<XStringTable>.singleton.GetString("PupilPromiseTitle"));
			}
			ixuilabel2.SetText(XMentorshipDocument.Doc.MentorshipApplyWords);
			IXUIButton ixuibutton = transform.Find("Setting").GetComponent("XUIButton") as IXUIButton;
			ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickSettingBtn));
		}

		// Token: 0x0600B2A5 RID: 45733 RVA: 0x00228930 File Offset: 0x00226B30
		private bool OnClickAddMentorShipBtn(IXUIButton button)
		{
			MyMentorship myMentorShip = XMentorshipDocument.Doc.GetMyMentorShip();
			bool flag = myMentorShip == MyMentorship.Mentorship_Master;
			if (flag)
			{
				XMentorshipDocument.Doc.SetCandidatesViewVisible(CandidatesViewType.Recommend, CandidatesViewRecommendType.Pupil);
			}
			else
			{
				bool flag2 = myMentorShip == MyMentorship.Mentorship_Pupil;
				if (flag2)
				{
					XMentorshipDocument.Doc.SetCandidatesViewVisible(CandidatesViewType.Recommend, CandidatesViewRecommendType.Master);
				}
			}
			return true;
		}

		// Token: 0x0600B2A6 RID: 45734 RVA: 0x0022897C File Offset: 0x00226B7C
		private bool OnClickPlayVoiceBtn(IXUIButton button)
		{
			return true;
		}

		// Token: 0x0600B2A7 RID: 45735 RVA: 0x00228990 File Offset: 0x00226B90
		private void OnStopSignPlay(object ob)
		{
			IXUISpriteAnimation ixuispriteAnimation = (IXUISpriteAnimation)ob;
			bool flag = ixuispriteAnimation != null;
			if (flag)
			{
				ixuispriteAnimation.SetFrameRate(0);
				ixuispriteAnimation.Reset();
			}
		}

		// Token: 0x0600B2A8 RID: 45736 RVA: 0x002289C0 File Offset: 0x00226BC0
		private void UpdatePupilsItem(Transform item, RoleBriefInfo info)
		{
			IXUILabel ixuilabel = item.Find("level").GetComponent("XUILabel") as IXUILabel;
			ixuilabel.SetText(info.level.ToString());
			IXUISprite ixuisprite = item.Find("head/p").GetComponent("XUISprite") as IXUISprite;
			ixuisprite.spriteName = ((XMentorshipDocument.Doc.GetMyMentorShip() == MyMentorship.Mentorship_Master) ? "bs_1" : "bs_0");
			IXUISprite ixuisprite2 = item.Find("head").GetComponent("XUISprite") as IXUISprite;
			ixuisprite2.spriteName = XSingleton<XProfessionSkillMgr>.singleton.GetProfHeadIcon2((int)((int)info.type % /*(RoleType)*/10));
			XFriendData friendDataById = DlgBase<XFriendsView, XFriendsBehaviour>.singleton.GetFriendDataById(info.roleID);
			IXUILabelSymbol ixuilabelSymbol = item.Find("Name").GetComponent("XUILabelSymbol") as IXUILabelSymbol;
			IXUILabel ixuilabel2 = item.Find("Name").GetComponent("XUILabel") as IXUILabel;
			IXUISprite ixuisprite3 = item.Find("ProfIcon").GetComponent("XUISprite") as IXUISprite;
			ixuisprite3.SetSprite(XSingleton<XProfessionSkillMgr>.singleton.GetProfIcon((int)((int)info.type % /*(RoleType)*/10)));
			bool flag = friendDataById != null;
			if (flag)
			{
				ixuilabel2.SetText("");
				ixuilabelSymbol.InputText = XSingleton<XCommon>.singleton.StringCombine(XTitleDocument.GetTitleWithFormat(friendDataById.titleID, friendDataById.name), XWelfareDocument.GetMemberPrivilegeIconString(friendDataById.paymemberid), XRechargeDocument.GetVIPIconString(friendDataById.viplevel));
			}
			else
			{
				ixuilabelSymbol.InputText = "";
				ixuilabel2.SetText(info.name);
			}
			IXUICheckBox ixuicheckBox = item.GetComponent("XUICheckBox") as IXUICheckBox;
			ixuicheckBox.ID = info.roleID;
			ixuicheckBox.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this.OnToggleRelationTarget));
			Transform transform = item.Find("RedPoint");
			bool flag2 = XMentorshipDocument.Doc.GetMyMentorShip() == MyMentorship.Mentorship_Pupil;
			if (flag2)
			{
				transform.gameObject.SetActive(!XMentorshipDocument.Doc.IsAllReported(info.roleID));
			}
			else
			{
				transform.gameObject.SetActive(!XMentorshipDocument.Doc.IsAllAgreed(info.roleID));
			}
		}

		// Token: 0x0600B2A9 RID: 45737 RVA: 0x00228BF8 File Offset: 0x00226DF8
		private bool OnToggleRelationTarget(IXUICheckBox iXUICheckBox)
		{
			bool bChecked = iXUICheckBox.bChecked;
			if (bChecked)
			{
				this._currentRoleID = iXUICheckBox.ID;
				bool flag = XMentorshipDocument.Doc.GetMyMentorShip() == MyMentorship.Mentorship_Master;
				if (flag)
				{
					this.UpdateMasterRightUI();
				}
				else
				{
					this.UpdatePupilRightUI();
				}
				this.RefreshRelationRightViewByRoleID();
				this.RefreshRedPoint();
			}
			return true;
		}

		// Token: 0x0600B2AA RID: 45738 RVA: 0x00228C54 File Offset: 0x00226E54
		private void RefreshRelationRightViewByRoleID()
		{
			ulong currentRoleID = this._currentRoleID;
			MyMentorship myMentorShip = XMentorshipDocument.Doc.GetMyMentorShip();
			bool flag = myMentorShip == MyMentorship.Mentorship_Master;
			string @string;
			if (flag)
			{
				@string = XSingleton<XStringTable>.singleton.GetString("HasPupil");
			}
			else
			{
				@string = XSingleton<XStringTable>.singleton.GetString("HasMaster");
			}
			int relationTargetsCount = XMentorshipDocument.Doc.GetRelationTargetsCount();
			IXUILabel ixuilabel = this._hasMentorship.Find("CurrentMentorInstruction").GetComponent("XUILabel") as IXUILabel;
			ixuilabel.SetText(string.Concat(new object[]
			{
				@string,
				relationTargetsCount.ToString(),
				"/",
				XMentorshipDocument.Doc.MaxRelationCount
			}));
			IXUILabel ixuilabel2 = this._hasMentorship.Find("MentorshipTask/ConditionBg/ConditonsLabel").GetComponent("XUILabel") as IXUILabel;
			int num = XMentorshipDocument.Doc.GetRelationPassedDays(this._currentRoleID, MentorRelationStatus.MentorRelationIn) + 1;
			int completedTaskCount = XMentorshipDocument.Doc.GetCompletedTaskCount(this._currentRoleID);
			ixuilabel2.SetText(string.Format(XSingleton<XStringTable>.singleton.GetString("MentorOverConditions"), completedTaskCount + "/" + XSingleton<XGlobalConfig>.singleton.GetInt("Mentor_NormalComplete"), num + "/" + XSingleton<XGlobalConfig>.singleton.GetInt("Mentor_NormalCompleteDay")));
		}

		// Token: 0x0600B2AB RID: 45739 RVA: 0x00228DBB File Offset: 0x00226FBB
		private void UpdateNoneRelationUI()
		{
			this.RefreshAcceptPupilConditions();
			this.RefreshApplyMasterConditions();
		}

		// Token: 0x0600B2AC RID: 45740 RVA: 0x00228DCC File Offset: 0x00226FCC
		private void RefreshApplyMasterConditions()
		{
			XLevelSealDocument specificDocument = XDocuments.GetSpecificDocument<XLevelSealDocument>(XLevelSealDocument.uuID);
			uint sealType = specificDocument.GetSealType();
			LevelSealTypeTable.RowData levelSealType = XLevelSealDocument.GetLevelSealType(sealType);
			int num = (levelSealType == null) ? 30 : levelSealType.ApplyStudentLevel;
			string format = XSingleton<UiUtility>.singleton.ReplaceReturn(XSingleton<XStringTable>.singleton.GetString("ToBeMasterCondition"));
			this._pupilCondition.SetText(string.Format(format, num));
		}

		// Token: 0x0600B2AD RID: 45741 RVA: 0x00228E38 File Offset: 0x00227038
		private void RefreshAcceptPupilConditions()
		{
			string text = XSingleton<UiUtility>.singleton.ReplaceReturn(XSingleton<XStringTable>.singleton.GetString("ToBePupilConditon"));
			this._masterCondition.SetText(text);
		}

		// Token: 0x0600B2AE RID: 45742 RVA: 0x00228E6D File Offset: 0x0022706D
		private void OnClickNextStep(IXUISprite uiSprite)
		{
			DlgBase<XCommonHelpTipView, XCommonHelpTipBehaviour>.singleton.ShowHelp(XSysDefine.XSys_Mentorship);
		}

		// Token: 0x040044C2 RID: 17602
		private IXUILabel _pupilCondition;

		// Token: 0x040044C3 RID: 17603
		private IXUILabel _masterCondition;

		// Token: 0x040044C4 RID: 17604
		private Transform _noMentorship;

		// Token: 0x040044C5 RID: 17605
		private Transform _hasMentorship;

		// Token: 0x040044C6 RID: 17606
		private Transform _setting;

		// Token: 0x040044C7 RID: 17607
		private Transform _pupilRewards;

		// Token: 0x040044C8 RID: 17608
		private Transform _gongKuTaskItemTrans;

		// Token: 0x040044C9 RID: 17609
		private IXUIScrollView _scrollView;

		// Token: 0x040044CA RID: 17610
		private IXUIWrapContent _reportWrapContent;

		// Token: 0x040044CB RID: 17611
		private IXUILabel _footPrintLabel;

		// Token: 0x040044CC RID: 17612
		private IXUICheckBox _footPrintCheck;

		// Token: 0x040044CD RID: 17613
		private IXUIInput _PromiseContentInput;

		// Token: 0x040044CE RID: 17614
		private bool _isCancelRecord;

		// Token: 0x040044CF RID: 17615
		private Vector2 _dragDistance;

		// Token: 0x040044D0 RID: 17616
		private ulong _currentRoleID = 0UL;

		// Token: 0x040044D1 RID: 17617
		private IXUIButton _reportBtn;
	}
}
